package com.score;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class Mp3ToByteArray {
    public static byte[] convertMp3ToByteArray(File file) throws IOException {
        FileInputStream fis = null;
        byte[] bytesArray = new byte[(int) file.length()];
        try {
            fis = new FileInputStream(file);
            fis.read(bytesArray); // read file into bytes[]
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

        return bytesArray;
}
}
